import random


def ObstacleCreate(obstacleNum, length, width, height, startPoint,endPoint):  # 障碍物生成
    obstacle = []
    fail = 0
    for i in range(obstacleNum):
        x = random.randint(0, length - 1) - 0.5
        y = random.randint(0, width - 1) - 0.5
        h = int(abs(random.gauss(int(height * 0.5) - 1, 5)))  # 随机生成位置点与高度
        location = (x, y, h)
        if x == startPoint[0]-0.5 and y == startPoint[1]-0.5:
            fail = 1
        if x == endPoint[0]-0.5 and y == endPoint[1]-0.5:
            fail = 1
        if fail == 0:
            obstacle.append(location)

    return obstacle  # 存储位置与高度信息
